<template>
  <div class="confirm-details-dialog">
    <el-dialog
      title="任务详情"
      :visible.sync="showDialog"
      width="700px"
      :before-close="handleClose"
      custom-class="dialog-box"
    >
      <el-descriptions
        label-width="140px"
        :column="1"
        size="medium"
        border
      >
        <el-descriptions-item label="任务名称" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.taskName }}
        </el-descriptions-item>
        <!-- <el-descriptions-item label="评审时间" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.reviewTimeStart + " ~ " + detailInfo.reviewTimeEnd }}
        </el-descriptions-item> -->
        <el-descriptions-item label="评审地点" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.reviewAddress }}
        </el-descriptions-item>
        <el-descriptions-item label="是否接受任务" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.accepet || "" }}
        </el-descriptions-item>
        <el-descriptions-item label="拒绝说明" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.refuseReason }}
        </el-descriptions-item>
        <el-descriptions-item label="处理时间" label-width="140px" label-class-name="descriptions-item-label" content-class-name="descriptions-content-width">
          {{ detailInfo.dealTime }}
        </el-descriptions-item>
      </el-descriptions>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { getExtReceiveInfo } from "@/api/manage/manage";
export default {
  name: "confirmDialog",
  props: {
    showDialog: {
      type: Boolean,
      default: "",
    },
    type: {
      type: String,
      default: "",
    },
    reviewTaskId: {
      type: String,
      default: "",
    },
    expertId: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      showTooltip: false,
      rules: {},
      ruleForm: {},
      detailInfo: {},
      text: "",
    };
  },
  methods: {
    handleClose() {
      this.$emit("changShow", "false");
    },
    submit() {
      this.$emit("changShow", "false");
    },
  },
  watch: {
    showDialog(val) {
      if (val) {
        getExtReceiveInfo(this.reviewTaskId, this.expertId).then((res) => {
          this.detailInfo = res.data;
          this.text = this.detailInfo.refuseReason;
          if (this.detailInfo.receiveStatus == "0") {
            this.detailInfo.accepet = "待接受";
          } else if (this.detailInfo.receiveStatus == "1") {
            this.detailInfo.accepet = "已接受";
          } else if (this.detailInfo.receiveStatus == "2") {
            this.detailInfo.accepet = "已拒绝";
          } else if (this.detailInfo.receiveStatus == "3") {
            this.detailInfo.accepet = "申请取消";
          }
        });
      }
    },
  },
};
</script>

<style lang="scss">
.confirm-details-dialog .dialog-box .descriptions-item-label{
  text-align: center;
  width: 140px;
}
</style>
